package cn.tedu.charging.user.controller;

import cn.tedu.charging.common.pojo.JsonResult;
import cn.tedu.charging.common.pojo.vo.UserInfoVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

@Api(tags = "用户")
@Slf4j
@RestController
@RequestMapping("/user")
public class UserController {

    @ApiOperation("获取用户信息")
    @GetMapping("/info/{userId}")
    public JsonResult getUserInfo(@PathVariable("userId") Integer userId){
        log.debug("获取用户信息-{}",userId);
        UserInfoVO userInfoVO=new UserInfoVO();
        userInfoVO.setCarId(999);
        return JsonResult.ok(userInfoVO);
    }

    @ApiOperation("获取用户余额")
    @GetMapping("/balance/{userId}")
    public JsonResult getUserBalance(@PathVariable("userId") Integer userId){
        log.debug("获取用户余额-{}",userId);
        BigDecimal balance=new BigDecimal(10000);
        return JsonResult.ok(balance);
    }
}
